
import { getLocalCity  } from "../../utils/HKMap";



export const getCityNameCreate = () => {
  return async (dispatch) => {
    // setTimeout(() => {
    //   dispatch({ type: "setCityName", value: "广州" });
    // }, 4000);
    // var myCity = new window.BMap.LocalCity();
    // myCity.get(function (result) {
    //   dispatch({ type: "setCityName", value: result.name });
    // });
    // const res=await HKMap.getLocalCity();

    const res=await getLocalCity();
    dispatch({ type: "setCityName", value: res.name.replace("市","") });
  }
} 

// 同步修改城市名称
export const changeCityName=(cityName)=>{
  return {
    type:"changeCityName",
    value:cityName
  }

}